package com.qinyunkj.searchchatserver.controller;

import com.qinyunkj.searchchatserver.model.entity.ArticleQA;
import com.qinyunkj.searchchatserver.service.ArticleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "文章分析接口")
@RestController
@RequestMapping("/api/articles/analysis")
@RequiredArgsConstructor
public class ArticleAnalysisController {

    private final ArticleService articleService;

    @Operation(summary = "分析文章")
    @PostMapping("/{articleId}")
    public void analyzeArticle(@PathVariable Long articleId) {
        articleService.analyzeArticle(articleId);
    }

    @Operation(summary = "生成文章问答")
    @PostMapping("/{articleId}/qa")
    public List<ArticleQA> generateQA(@PathVariable Long articleId) {
        return articleService.generateArticleQA(articleId);
    }

    @Operation(summary = "获取文章问答列表")
    @GetMapping("/{articleId}/qa")
    public List<ArticleQA> getArticleQAList(@PathVariable Long articleId) {
        return articleService.getArticleQAList(articleId);
    }
} 